﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Http;

using ProjectBase.Core;
using ProjectBase.Core.Storage;

namespace Survey.Web
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801
    public class MvcApplication : System.Web.HttpApplication
    {
        #region static properties & constructor
        /// <summary>Data Module, managing Sessions for DAO objects</summary>
        protected static readonly IHttpModule DataModule;
        static MvcApplication()
        {
            DataModule = new ProjectBase.Mvc.Web.DataHttpModule();
        }
        #endregion static properties & constructor

        public override void Init()
        {
            base.Init();
            DataModule.Init(this); // IHttpModule
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            ControllerConfig.RegisterFactory(ControllerBuilder.Current);
            ControlRenderConfig.RegisterControlRenderProvider();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }

        protected void Application_End(object sender, EventArgs e)
        {
            PublishingManager.Shutdown();
            SessionManager.Shutdown();
        }
    }
}